<template>
  <div>
    <NavBack title="意见反馈"></NavBack>

    <van-form @submit="submitForm">
      <van-field label="称呼" v-model="form.name" placeholder="请输入您的称呼" :rules="[{required:true}]"></van-field>
      <van-field label="手机号" v-model="form.phone" placeholder="请输入您的联系手机号" :rules="[{required:true}]"></van-field>
      <van-field label="邮箱" v-model="form.email" placeholder="请输入您的联系邮箱" :rules="[{required:true}]"></van-field>
      <van-field label="描述" rows="2" autosize type="textarea" maxlength="200" show-word-limit v-model="form.desc"
                 placeholder="请输入您的描述" :rules="[{required:true}]"></van-field>

      <div style="margin: 1rem">
        <van-button round block type="info">保存</van-button>
      </div>
    </van-form>
  </div>
</template>

<script>
import NavBack from "../common/NavBack";
import {status, user} from "../../request/api";

export default {
  name: "Idea",
  data() {
    return {form: {}};
  },
  components: {NavBack},
  methods: {
    async submitForm() {
      const res = await user.submitIdea(this.form);
      if (res.data.code == status.STATUS_SUCCESS) {
        this.$notify({type: 'success', message: res.data.msg});
        setTimeout(() => {
          this.$router.back();
        }, 2000);
      }
    },
  }
}
</script>

<style scoped>

</style>
